//
//  BodyCompositionViewController.m
//  SHHCPhone
//
//  Created by gfsh on 14-6-18.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "BodyCompositionViewController.h"
#import "MoveGuideViewController.h"
#import "WeightReferenceViewController.h"
#import "BodyView.h"
#import "BodyCell.h"
#import "DailyDietViewController.h"

@implementation BodyCompositionViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    navigationBarView.title = @"体成分";
    [navigationBarView setNormalLeftButton];
    
    [self initBtn];
    [self initContentView];
}

#pragma mark 体重分类数据
- (void)initContentView
{
    BodyView *bv = [[BodyView alloc]initWithFrame:CGRectMake(15, NAVIGATIONBAR_HEIGHT*2+10, 283, CURRENT_CONTENT_HEIGHT-(NAVIGATIONBAR_HEIGHT*2+10)-141)];
    [self.view addSubview:bv];
    
    UILabel *resultLab = [[UILabel alloc]initWithFrame:CGRectMake(15, bv.frame.origin.y+bv.frame.size.height+13, 283, 18)];
    resultLab.textAlignment = NSTextAlignmentLeft;
    resultLab.textColor = GET_COLOR(@"3e3e3e");
    resultLab.font = [UIFont systemFontOfSize:14];
    resultLab.text = @"根据测试结果获得专业指导";
    [self.view addSubview:resultLab];
    
    UIView *resultView = [[UIView alloc]initWithFrame:CGRectMake(15, resultLab.frame.origin.y+resultLab.frame.size.height+10, 283, 88)];
    resultView.backgroundColor = GET_COLOR(@"f6f6f6");
    resultView.layer.borderWidth = 1.f;
    resultView.layer.borderColor = GET_COLOR(@"dddddd").CGColor;
    resultView.layer.cornerRadius = 1.5;
    [self.view addSubview:resultView];
    
    UIButton *shipuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [shipuBtn addTarget:self action:@selector(shipuBtnClick) forControlEvents:UIControlEventTouchUpInside];
    shipuBtn.backgroundColor = [UIColor clearColor];
    shipuBtn.frame = CGRectMake(0, 0, resultView.frame.size.width, resultView.frame.size.height/2);
    UIImageView *heartIV = [[UIImageView alloc]initWithFrame:CGRectMake(5, shipuBtn.frame.size.height/2-16/2, 16, 16)];
    heartIV.image = [UIImage imageNamed:@"首页-心icon"];
    heartIV.userInteractionEnabled = YES;
    [shipuBtn addSubview:heartIV];
    UILabel *shipuLab = [[UILabel alloc]initWithFrame:CGRectMake(heartIV.frame.origin.x+heartIV.frame.size.width+8, 0, shipuBtn.frame.size.width-heartIV.frame.origin.x-heartIV.frame.size.width-8-30, shipuBtn.frame.size.height)];
    shipuLab.textAlignment = NSTextAlignmentLeft;
    shipuLab.textColor = GET_COLOR(@"3e3e3e");
    shipuLab.font = [UIFont systemFontOfSize:14];
    shipuLab.text = @"每日食谱指导";
    [shipuBtn addSubview:shipuLab];
    UIImageView *arrowIV = [[UIImageView alloc]initWithFrame:CGRectMake(shipuBtn.frame.size.width-22, shipuBtn.frame.size.height/2-14/2, 14, 14)];
    arrowIV.image = [UIImage imageNamed:@"体成分-箭头icon"];
    [shipuBtn addSubview:arrowIV];
    
    [resultView addSubview:shipuBtn];
    
    UIView *subline = [[UIView alloc]initWithFrame:CGRectMake(0, shipuBtn.frame.origin.x+shipuBtn.frame.size.height, shipuBtn.frame.size.width, 1)];
    subline.backgroundColor = GET_COLOR(@"dddddd");
    [resultView addSubview:subline];
    
    UIButton *yundongBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [yundongBtn addTarget:self action:@selector(yundongBtnClick) forControlEvents:UIControlEventTouchUpInside];
    yundongBtn.backgroundColor = [UIColor clearColor];
    yundongBtn.frame = CGRectMake(0, subline.frame.origin.y, resultView.frame.size.width, resultView.frame.size.height/2);
    UIImageView *heartIV1 = [[UIImageView alloc]initWithFrame:CGRectMake(5, yundongBtn.frame.size.height/2-16/2, 16, 16)];
    heartIV1.image = [UIImage imageNamed:@"首页-心icon"];
    heartIV1.userInteractionEnabled = YES;
    [yundongBtn addSubview:heartIV1];
    UILabel *yundongLab = [[UILabel alloc]initWithFrame:CGRectMake(heartIV1.frame.origin.x+heartIV1.frame.size.width+8, 0, yundongBtn.frame.size.width-heartIV1.frame.origin.x-heartIV1.frame.size.width-8-30, yundongBtn.frame.size.height)];
    yundongLab.textAlignment = NSTextAlignmentLeft;
    yundongLab.textColor = GET_COLOR(@"3e3e3e");
    yundongLab.font = [UIFont systemFontOfSize:14];
    yundongLab.text = @"运动指导";
    [yundongBtn addSubview:yundongLab];
    UIImageView *arrowIV1 = [[UIImageView alloc]initWithFrame:CGRectMake(yundongBtn.frame.size.width-22, yundongBtn.frame.size.height/2-14/2, 14, 14)];
    arrowIV1.image = [UIImage imageNamed:@"体成分-箭头icon"];
    [yundongBtn addSubview:arrowIV1];
    
    [resultView addSubview:yundongBtn];
    
}

#pragma mark 体重管理
- (void)initBtn
{
    UIView *btnBg = [[UIView alloc]initWithFrame:CGRectMake(0, NAVIGATIONBAR_HEIGHT, CURRENT_CONTENT_WIDTH, NAVIGATIONBAR_HEIGHT)];
    btnBg.backgroundColor = GET_COLOR(@"fe8cb6");
    [self.view addSubview:btnBg];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(CURRENT_CONTENT_WIDTH/2-250/2, btnBg.frame.size.height/2-41/2, 250, 41);
    [btn setBackgroundImage:[UIImage imageNamed:@"体成分页-进入管理按钮"] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:@"体成分页-进入管理按钮-点击"] forState:UIControlStateHighlighted];
    //btn.titleLabel.font = [UIFont systemFontOfSize:16];
    [btn setTitle:@"进入体重管理" forState:UIControlStateNormal];
    [btn setTitleColor:GET_COLOR(@"ffffff") forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [btnBg addSubview:btn];
}

- (void)btnClick
{
    WeightReferenceViewController *wrvc = [[WeightReferenceViewController alloc]init];
    [self.navigationController pushViewController:wrvc animated:YES];
}

#pragma mark 每日食谱、运动指导
- (void)shipuBtnClick
{
    DailyDietViewController *mgvc = [[DailyDietViewController alloc]init];
    [mgvc setShowBackBtn:YES];
    [self.navigationController pushViewController:mgvc animated:YES];
}

- (void)yundongBtnClick
{
    MoveGuideViewController *mgvc = [[MoveGuideViewController alloc]init];
    [mgvc setShowBackBtn:YES];
    [self.navigationController pushViewController:mgvc animated:YES];
}

-(void)leftButtonClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];

}

@end
